home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trusted Irix /B 4.0.4
/
Trusted-Irix B-4.0.1.iso
/
dist
/
eoe1.idb
/
usr
/
include
/
sys
/
msg.h.z
/
msg.h
Wrap
C/C++ Source or Header
|
1992-04-03
|
4KB
|
153 lines
/*
* msg.h --
*
* header for msg(2)
*
*
* Copyright 1990, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
/* Copyright (c) 1984 AT&T */
/* All Rights Reserved */
/* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
/* The copyright notice above does not evidence any */
/* actual or intended publication of such source code. */
#ifndef __SYS_MSG_H__
#define __SYS_MSG_H__
#ifdef __cplusplus
extern "C" {
#endif
#ident "$Revision: 3.12 $"
/*
** IPC Message Facility.
*/
/*
** Implementation Constants.
*/
#ifdef _KERNEL
#define PMSG (PZERO + 2) /* message facility sleep priority */
#endif /* _KERNEL */
/*
** Permission Definitions.
*/
#define MSG_R 0400 /* read permission */
#define MSG_W 0200 /* write permission */
/*
** Message Operation Flags.
*/
#define MSG_NOERROR 010000 /* no error if big message */
/*
** Structure Definitions.
*/
/*
** There is one msg queue id data structure for each q in the system.
*/
struct msqid_ds {
struct ipc_perm msg_perm; /* operation permission struct */
struct msg *msg_first; /* ptr to first message on q */
struct msg *msg_last; /* ptr to last message on q */
ushort msg_cbytes; /* current # bytes on q */
ushort msg_qnum; /* # of messages on q */
ushort msg_qbytes; /* max # of bytes on q */
ushort msg_lspid; /* pid of last msgsnd */
ushort msg_lrpid; /* pid of last msgrcv */
time_t msg_stime; /* last msgsnd time */
time_t msg_rtime; /* last msgrcv time */
time_t msg_ctime; /* last change time */
};
/*
** User message buffer template for msgsnd and msgrecv system calls.
*/
struct msgbuf {
long mtype; /* message type */
char mtext[1]; /* message text */
};
/*
** Message information structure.
*/
struct msginfo {
int msgmax, /* max message size */
msgmnb, /* max # bytes on queue */
msgmni, /* # of message queue identifiers */
msgssz, /* msg segment size (should be word size multiple) */
msgtql; /* # of system message headers */
ushort msgseg; /* # of msg segments (MUST BE < 32768) */
};
#ifdef _KERNEL
/* Each message queue is locked with its own semaphore,
** and has its own readers/writers waiting semaphore.
** We cannot add anything to the msqid_ds structure since
** this is used in user programs and any change would break
** object file compatibility. Therefore, we allocate a
** parallel array, msglock, which contains the message queue
** locks and semaphores. The array is defined in the msg master
** file. The following macro takes a pointer to the message
** queue and returns its corresponding semaphore structure entry.
**/
#define MSGADDR(X) msgsem[X]
struct msgsem {
sema_t msg_lock; /* lock for msqid_ds structure */
sema_t msg_rwait; /* to wait to read a msg */
sema_t msg_wwait; /* to wait to write a msg */
};
/*
** There is one msg structure for each message that may be in the system.
*/
struct msg {
struct msg *msg_next; /* ptr to next message on q */
long msg_type; /* message type */
short msg_ts; /* message text size */
caddr_t msg_spot; /* message text map address */
};
#endif /* _KERNEL */
#ifndef _KERNEL
extern int msgctl(int, int, ...);
extern int msgget(key_t, int);
extern int msgrcv(int, struct msgbuf *, int, long, int);
extern int msgsnd(int, const struct msgbuf *, int, int);
#endif /* !_KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* !__SYS_MSG_H__ */